import { reqGetSearchInfo } from '@/api'

const state = {
  searchList: {}
}
const mutations = {
  GETSEARCHLIST(state, searchList) {
    state.searchList = searchList
  }
}
const actions = {
  async getSearchList({ commit }, params = {}) {
    const res = await reqGetSearchInfo(params)
    if (res.code == 200) {
      commit('GETSEARCHLIST', res.data)
    }
  }
}
const getters = {
  goodsList(state) {
    return state.searchList.goodsList
  },
  // 商品属性数组
  attrsList(state) {
    return state.searchList.attrsList
  },
  // 品牌名称数组
  trademarkList(state) {
    return state.searchList.trademarkList
  }
}

export default {
  state,
  mutations,
  actions,
  getters
}
